import fetch from 'utils/fetch';

//新增代理商
export function createAgent(data) {
  return fetch({
    url: 'api/admin/distributor/create',
    method: 'post',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    data
  });
}

//代理商查询
export function agentAll(data) {
  return fetch({
    url: 'api/admin/distributor/screenSelectDistributor',
    method: 'post',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    data
  });
}

//代理商详情
export function agentDetails(id) {
  return fetch({
    url: 'api/admin/distributor/getDistributorIdFindDistributor/'  + id,
    method: 'get',
    headers: {'Content-type': 'application/json;charset=UTF-8'}
  });
}

//修改代理商
export function modifyAgent(data) {
  return fetch({
    url: 'api/admin/distributor/update',
    method: 'post',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    data
  });
}

//审核代理商
export function updateStateAgent(data) {
  return fetch({
    url: 'api/admin/distributor/updateState' ,
    method: 'post',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    data
  });
}

//查询业务员
export function salesmanList(data) {
  return fetch({
    url: 'api/admin/salesman/screenSelectSalesman',
    method: 'post',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    data
  });
}

//修改代理商查询业务员
export function salesmanAll(data) {
  return fetch({
    url: 'api/admin/salesman/getFindDistributorSalesman',
    method: 'post',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    data
  });
}



//新增业务员
export function salesmanAdd(data) {
  return fetch({
    url: 'api/admin/salesman/insertSelective',
    method: 'post',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    data
  });
}

//查询上级代理
export function querySuperiorAgent(data) {
  return fetch({
    url: 'api/admin/distributor/getcompanyIdFindDistributor',
    method: 'post',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    data
  });
}


//验证业务员编号
export function validateSalesmanNum(salesmanNumber) {
  return fetch({
    url: 'api/admin/salesman/getSalesmanNumberFindSalesman/' + salesmanNumber,
    method: 'get',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
  });
}

//修改业务员信息
export function modifySalesman(data) {
  return fetch({
    url: 'api/admin/salesman/updateSalesman',
    method: 'post',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    data
  });
}

//删除审核未通过代理商
export function delAgent(id) {
  return fetch({
    url: 'api/admin/distributor/deleteDistributor/' + id + '/s',
    method: 'post',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
  });
}